/**
 * 
 */
package com.ms.game.invitefriend.async;

import com.ms.game.invitefriend.db.InviteFriendDAO;
import com.ms.game.invitefriend.message.CGetDownLineListRequest;
import com.ms.game.invitefriend.message.SGetDownLineListResponse;
import com.ms.player.Player;
import com.xpec.c4.game.utility.GUID;
import com.xpec.c4.message.MessageTypes;
import com.xpec.c4.service.message.MessageAction;
import com.xpec.c4.service.module.task.TaskAsyncCommand;

/**
 * 取得指定角色的下線清單
 * 
 * @author TW15010
 */
public class GetDownLineListAsync extends TaskAsyncCommand {
	public Player player;
	
	/**
	 * 角色 guid
	 */
	public GUID playerGuid;

	/**
	 * 角色 session id
	 */
	public GUID sessionId;

	/**
	 * 取得下線清單的求參數
	 */
	public CGetDownLineListRequest request;

	/**
	 * 回傳值，下線清單
	 */
	public SGetDownLineListResponse response;

	public GetDownLineListAsync(Player player, GUID sessionId, CGetDownLineListRequest request) {
		super();
		this.player = player;
		this.playerGuid = player.getGuid();
		this.sessionId = sessionId;
		this.request = request;
	}

	@Override
	public void asyncExecute() throws Exception {
		// 取得清單
		response = InviteFriendDAO.getDownLineList(playerGuid, request);
	}

	@Override
	public void execute() throws Exception {
		// 回傳給 client
		MessageAction.sendMessage(sessionId, MessageTypes.S_CHARACTER_INFO_GET_DOWN_LINE_LIST_RESPONSE, response);
	}
}
